
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

import main.framework.setting.Config;

public class MySQLConnector {

	private Connection connection;
	
	public void connect() throws ClassNotFoundException, SQLException {
		// Load the driver
		Class.forName ("com.mysql.jdbc.Driver");
		this.connection = DriverManager.getConnection("jdbc:mysql://" + Config.DB_HOST + ":" + Config.DB_PORT + "/" + Config.DB_NAME + "?" + "user=" + Config.DB_USER + "&" + "password=" + Config.DB_USER_PW);
	}

	public void executeQuery(String query) throws SQLException {
		Statement statement = this.connection.createStatement();
		statement.execute(query);
	}
	
	public void disconnect() throws SQLException{
		this.connection.close();
	}

}
